<?php

$v_status = -1;
if(isset($_REQUEST['hdn_status'])){	
	$v_status = intval($_REQUEST['hdn_status']);
}

$v_method = 1;

$v_filter = "";
if(isset($_REQUEST['hdn_filter'])){
	$v_filter = _replace_bad_char($_REQUEST['hdn_filter']);
}

$v_agency_id = 0;
if(isset($_REQUEST['hdn_agency_id'])){
	$v_agency_id = intval($_REQUEST['hdn_agency_id']);
}

$v_cate_id = 0;
if(isset($_REQUEST['hdn_cate_id'])){
	$v_cate_id = intval($_REQUEST['hdn_cate_id']);
} 
// Neu chua khoi tao thi khoi tao la linh vuc dau tien cua danh sach
if ($v_cate_id==0 && sizeof($arr_all_cate_for_staff)>0){
	$v_cate_id = $arr_all_cate_for_staff[0]['0'];
}


$v_date_start_sp = "";
$v_date_end_sp = "";

$v_limit = _CONST_NUMBER_OF_ROW_PER_LIST;

if(isset($_REQUEST['hdn_page'])){
	$v_page=intval($_REQUEST['hdn_page']);
}else{
	$v_page=1;
}


//Luu ten cua linh vuc 
$v_cate = "";
if(isset($_REQUEST['hdn_cate'])){
	$v_cate = $_REQUEST['hdn_cate'];
} 

$v_agency = "";
if(isset($_REQUEST['hdn_agency'])){
	$v_agency = $_REQUEST['hdn_agency'];
}


//Lay cac thong tin ve trang thai cua trang
$v_top_id  =   0;
if(isset($_REQUEST['hdn_top_id'])){
	$v_top_id = intval($_REQUEST['hdn_top_id']);
} 
$v_bottom_id = 0;
if(isset($_REQUEST['hdn_bottom_id'])){
	$v_bottom_id = intval($_REQUEST['hdn_bottom_id']);
} 
$v_exception_qa_id  = 0;
if(isset($_REQUEST['hdn_exception_qa_id'])){
	$v_exception_qa_id = intval($_REQUEST['hdn_exception_qa_id']);
}
$v_direction  = 'TOP';
if(isset($_REQUEST['hdn_direction'])){
	$v_direction = trim($_REQUEST['hdn_direction']);
}
$v_staff_id=  $_SESSION['staff_id'];
//$v_staff_id = "";
$v_number_qa_question_per_page = CONST_LIMIT_QA_PER_PAGE;
$v_filter = "%". $v_filter . "%";
if(_is_sqlserver()){
	$sql = "Exec Onegate_QAGetAllPerPage " ;
	$sql = $sql.$v_status.",";
	$sql = $sql.$v_method.",";
	$sql = $sql."'".$v_filter."',";
	$sql = $sql.$v_agency_id.",";
	$sql = $sql.$v_cate_id.",";
	$sql = $sql."'".$v_date_start_sp."',";
	$sql = $sql."'".$v_date_end_sp."'";
	$sql = $sql.",".$v_page;
	$sql = $sql.",".$v_limit;
	//echo $sql; //exit;
	$ado_conn->SetFetchMode(ADODB_FETCH_ASSOC);
	$arr_all_onegate_qa = $ado_conn->GetAll($sql); 
	$v_qa_count=sizeof($arr_result);
}
//Neu nhu khong co quyen tren tat ca cac linh vuc thi khong duoc xem cau hoi nao
if (sizeof($arr_all_cate_for_staff)==0){
	$arr_all_onegate_qa = NULL;
}
$v_total_qa = $arr_all_onegate_qa[0]['TOTAL_QA'];
?>